/**
 * Created by nengjian on 2017/4/17.
 */
var utils = require('../utils'),
    pipeline = require('../../utils/pipeline');

module.exports = app => {
    return class Posts extends app.Service {
        * find(uid) {
            //return yield app.mysql.get('posts', {id: uid,});
        }
        * findAll() {
            function doQuery(options) {
                return app.model.Post.forge().fetch();
            }
            return pipeline([doQuery], {}).then(function formatResponse(result) {
                if (result) {
                    return result.attributes;
                }
            })
        }
    }
};